/*
 * @Description: Have A Nice Day!
 * @Author: Jacky
 * @Date: 2020-02-10 16:59:06
 * @LastEditors  : Jacky
 * @LastEditTime : 2020-02-13 13:47:04
 */
import React from 'react'
import './index.css'
import { connect } from 'react-redux'
import { TOGGLE_DIALOG } from './../../store/types'
function Dialog(props) {
    let { title, children } = props;
    let closeDialog = () => {
        props.dispatch({
            type: TOGGLE_DIALOG
        })
    }
    return (
        <div className="dialog-masker" onClick={closeDialog}>
            <div className="dialog-wrap" onClick={(e)=>{e.stopPropagation()}}>
                <div className="dialog-title">
                    {title}
                </div>
                <div className="dialog-content">
                    {children}
                </div>
            </div>
        </div>
    )
}

export default connect(null)(Dialog)
